The package ClimateMARGO.jl could not load because it failed to initialize.
That's not nice! Things you could try:
- Restart the notebook.
- Try a different Julia version.
- Contact the developers of ClimateMARGO.jl about this error.
You might find useful information in the package installation log:
👀 Reading hidden code
begin
import Pkg
ENV["JULIA_MARGO_LOAD_PYPLOT"] = "no thank you"
import ClimateMARGO
using ClimateMARGO.Models
using ClimateMARGO.Optimization
using ClimateMARGO.Diagnostics
end
Activating new project at `/Users/fons/Documents/MargoAPI.jl`
👀 Reading hidden code
Enter cell code...
12
👀 Reading hidden code
dt = 12
Another cell defining ClimateMARGO contains errors.
C'est la vie !
begin
model_parameters = deepcopy(ClimateMARGO.IO.included_configurations["default"])::ClimateModelParameters
model_parameters.domain = Domain(Float64(dt), 2020.0, 2200.0)
model_parameters.economics.baseline_emissions = ramp_emissions(model_parameters.domain)
model_parameters.economics.extra_CO₂ = zeros(size(model_parameters.economics.baseline_emissions))
end
👀 Reading hidden code
Base.@kwdef mutable struct MRGA{T}
M::T
R::T
G::T
A::T
end
👀 Reading hidden code
UndefVarError: ClimateModel not defined
model = ClimateModel(model_parameters)
👀 Reading hidden code
Another cell defining ClimateMARGO and model_results contains errors.
model_results(model)
👀 Reading hidden code
"geoeng"
0.0125
"mitigate"
0.025
"remove"
0.025
"adapt"
0.0
max_slope = Dict("mitigate"=>1. /40., "remove"=>1. /40., "geoeng"=>1. /80., "adapt"=> 0.)
👀 Reading hidden code
Current syntax
👀 Reading hidden code
enforce_maxslope! (generic function with 1 method)
function enforce_maxslope!(controls;
dt,
max_slope=Dict("mitigate"=>1. /40., "remove"=>1. /40., "geoeng"=>1. /80., "adapt"=> 0.)
)
controls.mitigate[1] = 0.0
controls.remove[1] = 0.0
controls.geoeng[1] = 0.0
# controls.adapt[1] = 0.0
for i in 2:length(controls.mitigate)
controls.mitigate[i] = clamp(
controls.mitigate[i],
controls.mitigate[i-1] - max_slope["mitigate"]*dt,
controls.mitigate[i-1] + max_slope["mitigate"]*dt
)
controls.remove[i] = clamp(
controls.remove[i],
controls.remove[i-1] - max_slope["remove"]*dt,
controls.remove[i-1] + max_slope["remove"]*dt
)
controls.geoeng[i] = clamp(
controls.geoeng[i],
controls.geoeng[i-1] - max_slope["geoeng"]*dt,
controls.geoeng[i-1] + max_slope["geoeng"]*dt
)
controls.adapt[i] = clamp(
controls.adapt[i],
controls.adapt[i-1] - max_slope["adapt"]*dt,
controls.adapt[i-1] + max_slope["adapt"]*dt
)
end
end
👀 Reading hidden code
UndefVarError: t not defined
N = length(t(model))
👀 Reading hidden code
Another cell defining ClimateMARGO contains errors.
begin
model.controls.geoeng .= 0.5
enforce_maxslope!(model.controls; dt=dt)
model.controls
end
👀 Reading hidden code
Compact syntax
👀 Reading hidden code
# function enforce_maxslope!(controls;
# max_slope=MRGA(1/40, 1/40, 1/80, 0)
# )
# for (tech, value) in controls
# value[1] = 0.0
# for i in 2:N
# value[i] = clamp(
# value[i],
# value[i-1] - max_slope[tech]*dt,
# value[i-1] + max_slope[tech]*dt
# )
# end
# end
# end
👀 Reading hidden code
Another cell defining ClimateMARGO contains errors.
model.economics
👀 Reading hidden code
UndefVarError: ClimateModel not defined
Here is what happened, the most recent locations are first:
model_results(model::ClimateModel) = Dict(
:controls => model.controls,
:computed => Dict(
:temperatures => Dict(
:baseline => T_adapt(model),
:M => T_adapt(model; M=true),
:MR => T_adapt(model; M=true, R=true),
:MRG => T_adapt(model; M=true, R=true, G=true),
:MRGA => T_adapt(model; M=true, R=true, G=true, A=true),
),
:emissions => Dict(
:baseline => effective_emissions(model),
:M => effective_emissions(model; M=true),
:MRGA => effective_emissions(model; M=true, R=true),
),
:concentrations => Dict(
:baseline => c(model),
:M => c(model; M=true),
:MRGA => c(model; M=true, R=true),
),
:damages => Dict(
:baseline => costs_dict(damage(model; discounting=true), model),
:MRGA => costs_dict(damage(model; M=true, R=true, G=true, A=true, discounting=true), model),
),
:costs => Dict(
:M => costs_dict(cost(model; M=true, discounting=true), model),
:R => costs_dict(cost(model; R=true, discounting=true), model),
:G => costs_dict(cost(model; G=true, discounting=true), model),
:A => costs_dict(cost(model; A=true, discounting=true), model),
:MRGA => costs_dict(cost(model; M=true, R=true, G=true, A=true, discounting=true), model),
),
),
)
👀 Reading hidden code
costs_dict (generic function with 1 method)
function costs_dict(costs, model)
Dict(
:discounted => costs,
:total_discounted => sum(costs .* model.domain.dt),
)
end
👀 Reading hidden code